<?php session_start();
	include_once $_SERVER["DOCUMENT_ROOT"].'/outils/logger/Logger.php';

	function includeIfExists($fichier) {
		if (file_exists($fichier)) {
			include_once $fichier;
		}
	}

	//inclusion des modules
	//TODO avoir un Xml de config par module plutôt, contenant tous les include des modules
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/news/GererNewsAction.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/news/NewsViewHelper.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/autregroupe/GererAutreGroupeAction.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/autregroupe/AutreGroupeViewHelper.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/concert/GererConcertAction.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/concert/ConcertViewHelper.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/photo/PhotoViewHelper.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/musique/MusiqueViewHelper.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/photo/GererPhotoActionOutilPhoto.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/photo/GererPhotoAction.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/albumphoto/GererAlbumPhotoAction.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/albumphoto/AlbumPhotoViewHelper.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/musique/GererMusiqueActionOutilPhoto.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/musique/GererMusiqueAction.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/albummusique/GererAlbumMusiqueAction.php');
	includeIfExists ($_SERVER["DOCUMENT_ROOT"].'/web/albummusique/AlbumMusiqueViewHelper.php');
	
	
	//autres fichiers
	include_once $_SERVER["DOCUMENT_ROOT"].'/outils/parameters/ParameterGetter.php';
	include_once $_SERVER["DOCUMENT_ROOT"].'/outils/writerJSON/WriterJSON.php';
	
	try {
		$cmd = ParameterGetter::getRequestParameter("cmd", true);
		$className = ParameterGetter::getRequestParameter("className", true);
		Logger::getLogger()->logInfo("Appel par le forwarder : ".$className."::".$cmd);
		call_user_func(array($className, $cmd));
		Logger::getLogger()->logInfo("Fin de l'appel");
	} catch(Exception $e) {
		WriterJSON::echoError ($e->__toString());
	}
?>